www.gusucode.com > XerCMS 携云PHP企业建站程序 v2015PHP源码程序 > XerCMS 携云PHP企业建站程序 v2015/XerCMS_v20150724/XerCMS_v20150724/XerCMS/Modules/archives/search.php

    <?php
/**
 * @name     XERCMS
 * @author   Arno <XerCMS@163.com> [QQ:1328013]
 * @version  1.0.0
 * @link     http://www.XerCMS.com 
 */
 
!defined('XERCMS') && exit('Access Denied');


class XerCMS_MODULE_search
{ 
     function XerCMS() {
          $this->Simple();
     }
     
     function Simple() {
          $where = array();
          isset($_GET['flag']{0})   && $where[] = 'arc.flag = \''.int1(g('flag')).'\'';
          isset($_GET['model']{0})  && $where[] = 'arc.model = \''.int1(g('model')).'\'';
          isset($_GET['icon']{0})   && $where[] = 'arc.icon = \''.int1(g('icon')).'\'';
          isset($_GET['days']{0})   && $where[] = 'arc.ctime > \''.(X::$G['time'] - (ini1(g('days')) * 86400)).'\'';
          isset($_GET['column']{0}) && $where[] = 'arc.column = \''.int1(g('column')).'\'';
          isset($_GET['area']{0})   && $where[] = 'arc.area = \''.int1(g('area')).'\'';
          isset($_GET['lang']{0})   && $where[] = 'arc.lang = \''.int1(g('lang')).'\'';
          
          $page = int1(g('page'));$key = $_GET['title'];
          if(isset($key{180})) {
               $key = mb_substr($key,0,180);
          }
          $key = strfilter($key);
          !empty($key) && $where[] = 'arc.title like \'%'.$key.'%\'';
          $where = implode(' AND ',$where);
          $where = ' WHERE arc.`state` in ('.(in_array(X::$G['uid'],X::$G['superadmin']) ? '0,1' : '1').') '.(empty($where) ? '' : ' AND '.$where);
          $total = DB::result_first('SELECT count(*) FROM xercms_archives arc '.$where);
          if(empty($total)) {
               showtips('search_nothing',dreferer());
          }
          
          $where .= ' ORDER BY arc.'.inArray(g('by'),array('ctime','mtime'));//,'hits','flower','egg','score'
          $where .= ' '.inArray(g('order'),array('DESC','ASC'));
          $where .= ' LIMIT '.(($page-1)*30).',30';
          $searchlist = DB::fetch_all('SELECT arc.*,co.*,m.nick FROM xercms_archives arc
               LEFT JOIN xercms_count co ON co.id = arc.id
               LEFT JOIN xercms_member_profile m ON m.uid = arc.uid'.$where);
          $multipage = multi($total/30,$page);
          include_once(tpl('archives/search.htm'));        
     }    
}
?>